<template>
	<uni-popup ref="popupModal" type="dialog">
		<uni-popup-dialog :cancelText="option.lef" :confirmText="option.rig" :title="title" @confirm="confirm"
			@close="close">
			<slot></slot>
		</uni-popup-dialog>
	</uni-popup>
</template>

<script>
	export default {
		name: "popup-modal",
		props: {
			option: {
				type: Object,
				default () {
					return {
						title: '',
						lef: '取消',
						rig: '确定'
					}
				},
			},
			title: {
				type: String,
				default: '',
			},
		},
		data() {
			return {

			}
		},
		methods: {
			open() {
				this.$refs.popupModal.open()
			},
			confirm(item) {
				this.$emit("confirm", item);
				this.$refs.popupModal.close();
			},
			close(item) {
				this.$emit("close");
				// this.$refs.popupModal.close();
			}
		}
	}
</script>

<style lang="scss" scoped>
</style>